<?php

//tcp链接  ps -ajft
//telnet localhost 9501

$host = '0.0.0.0';

$port = 9501;

$serv = new swoole_server($host,$port);


$serv->on('connect',function ($serv,$fd){
       echo "建立连接\n";
});


$serv->on('receive',function ($serv,$fd,$from_id,$data){
    echo "接收到数据\n";
    print_r ($data);
});


$serv->on('close',function ($serv,$fd){
    echo "链接关闭\n";
});

$serv->start();
